package cn.itcast.dewu.controller;

import cn.itcast.dewu.dto.Result;
import cn.itcast.dewu.service.FollowService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/follow")
public class FollowController {
    @Autowired
    private FollowService followService;
    /*
    关注按钮
    参数: 被关注人的id , 关注还是 取消关注
    * */
    @PutMapping("/{id}/{isFollow}")
    public Result follow(@PathVariable("id") Long followUserId, @PathVariable("isFollow") Boolean isFollow) {
        return followService.follow(followUserId, isFollow);
    }
    /*
    * 判断用户是否关注
    * 参数 被关注的id
    * */
    @GetMapping("/or/not/{id}")
    public Result isFollow(@PathVariable("id") Long followUserId) {
        return followService.isFollow(followUserId);
    }
}
